package com.weixin.paleituo.activity;

import android.content.Context;
import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.adapter.AfterSalePagerAdapter;
import com.weixin.paleituo.base.BaseActivity;
import com.weixin.paleituo.view.ForbidScrollViewpager;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 售后申请
 */
public class AfterSaleActivity extends BaseActivity {


    @BindView(R.id.iv_back_activity_basepersoninfo)
    ImageView mIvBackActivityBasepersoninfo;
    @BindView(R.id.tv_title_activity_baseperson)
    TextView mTvTitleActivityBaseperson;
    @BindView(R.id.tv_small_title_layout_head)
    TextView mTvSmallTitleLayoutHead;
    @BindView(R.id.rl_head_root_activity_baseperson)
    RelativeLayout mRlHeadRootActivityBaseperson;
    @BindView(R.id.tl_tab_activity_after_sale)
    TabLayout mTlTabActivityAfterSale;
    @BindView(R.id.forbidscroll_viewpager_activity_after_sale)
    ForbidScrollViewpager mForbidscrollViewpagerActivityAfterSale;
    private   String[] arrtitle={"售后申请","申请记录"};
    private AfterSalePagerAdapter mAfterSalePagerAdapter;

    @Override
    protected void initView() {
        setContentView(R.layout.activity_after_sale);
    }


    @Override
    protected void initData() {


        mTvTitleActivityBaseperson.setText("售后申请");

        mAfterSalePagerAdapter = new AfterSalePagerAdapter(getSupportFragmentManager(),arrtitle);
        //将ViewPager关联到TabLayout上
        //   mForbidscrollViewpagerClassifyFragment.setOffscreenPageLimit(data.size());
        mForbidscrollViewpagerActivityAfterSale.setAdapter(mAfterSalePagerAdapter);
        mTlTabActivityAfterSale.setupWithViewPager(mForbidscrollViewpagerActivityAfterSale);

        mTlTabActivityAfterSale.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                //切换ViewPager
                mForbidscrollViewpagerActivityAfterSale.setCurrentItem(tab.getPosition(),false);
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });



    }

    @OnClick(R.id.iv_back_activity_basepersoninfo)
    public void onMIvBackActivityBasepersoninfoClicked() {
        finish();

    }
        /**
        开启a Activity
        **/

        public  static void myStartActivity(Context context){
         Intent intent=new Intent(context,AfterSaleActivity.class);
         context.startActivity(intent);

        }
}

